package com.javabase.study.ArrayStudy;

/**
 * TODO
 * 内容：测试学习数组的使用
 * 作者:jxx
 * 创建时间：2021/6/21
 */
public class TestArray {
    public static void main(String[] args){

        //使用循环遍历初始化和读取数组
        int[] a = new int[4];
        for (int i = 0;i < a.length; i++){
            a[i] = i * 100;
        }

        for (int j = 0;j < a.length; j++){
            System.out.println(a[j]);
        }

        String[] str = {"aa","bb","cc"};
        for(String tem : str){
            System.out.println(tem);
        }

        String[] s = {"阿里","京东","百度","腾讯","美团"};
        String[] sBak = new String[7];

        System.arraycopy(s,0,sBak,0,5);
        for (int i = 0;i < sBak.length; i++){
            System.out.print(sBak[i] + "\t");
        }
        System.out.println("");
        for(String temp : sBak){
            System.out.print(temp + "\t");
        }
    }
}
